﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Traceability.Commont.Domains.AnimalsDomainFiles;
using Traceability.Commont.Domains.BatchManagementFiles;
using Traceability.Commont.DTOs;
using Traceability.Commont.DTOs.BatchManagementDTOs;
using Traceability.Commont.DTOs.CommontFiles;
using Traceability.Commont.DTOs.WhiteStripWeighingHtmlGroup;
using U.Enterprise.Api.Applications.AdmissionRegistrationFile;
using U.Enterprise.Api.Applications.BatchManagements;
using U.Enterprise.Api.Applications.ByProducts;
using U.Enterprise.Api.Applications.EndingOnly;
using U.Enterprise.Api.Applications.LoginNEwSheet;
using U.Enterprise.Api.Applications.ReturnWeighing;
using U.Enterprise.Api.Applications.WhitestripWeighing;

namespace U.Enterprise.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class BatchController : ControllerBase
    {
        private readonly IMediator mediator;

        public BatchController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 皮重设置单添加
        /// </summary>
        /// <param name="info">皮重设置单实体</param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> AddTareset(TareSetCreateCommand info)
        {
            try
            {
                var res = await mediator.Send(info);
                return res;
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 皮重查询显示
        /// </summary>
        /// <param name="info">查询DTO</param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PageDTO<TareListDTO>> SelectTareList(TareSetListCommand info)
        {
            try
            {
                var res=await mediator.Send(info);
                return res;
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 批宰计划选择
        /// </summary>
        /// <param name="info">查询DTO</param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults<SlaugSelectDTO>> SlaughterSelectionList(SlaughterSelectionCommand info)
        {
            try
            {
                var res = await mediator.Send(info);
                return res;
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 绑定显示屠宰计划
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> bilkBind(BulkSlaughterBindCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 白条称重分组
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults<WhiteGroupDTO>> WhiteStripWeighingHtml(WhiteStripWeighingHtmlCommond request, CancellationToken cancellationToken)
        {

            var result =await mediator.Send(request);


            return result;



        }
        /// <summary>
        /// 白条下拉列表 展示
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> WhiteStripWeighingSelect(WhiteStripWeighingSelectViewCommond request, CancellationToken cancellationToken)
        {

            var result = await mediator.Send(request);

            return result;



        }
        /// <summary>
        /// 白条称重添加
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> WhiteStripWeighingCreate(WhiteStripWeighingCreateCommon request, CancellationToken cancellationToken)
        {
            var list = await mediator.Send(request);
            return list;
        }


        /// <summary>
        /// 白条修改
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// 

        [HttpPost]
        public async Task<Resqults> WhiteStripWeighingUpdate(WhiteStripWeighingUpdateViewCommond request, CancellationToken cancellationToken)
        {


            var list =await mediator.Send(request);
           


            return list;




        }



        /// <summary>
        /// 白条赋值
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> WhiteStripWeighingBackView(WhiteStripWeighingBackViewCommond request, CancellationToken cancellationToken)
        {
            var list = await mediator.Send(request);


            return list;

        }




        /// <summary>
        /// 白条显示
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> WhiteStripWeighingView(WhiteStripWeighingViewCommond request, CancellationToken cancellationToken)
        {
            try
            {
                var list = await mediator.Send(request);


                return list;
            }
            catch (Exception)
            {

                throw;
            }

        }



        /// <summary>
        /// 白条删除
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> WhiteStripWeighingDel(WhiteStripWeighingDelCommond request, CancellationToken cancellationToken)
        {
            var list = await mediator.Send(request);
            return list;





        }

        /// <summary>
        /// 副产添加
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> ReturnWeighingCreate(ReturnWeighingCreateCommond request, CancellationToken cancellationToken)
        {


            var result = await mediator.Send(request);



            return result;

        }

        /// <summary>
        /// 副产显示
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> ReturnWeighingHtml(ReturnWeighingHtmlCommondcs request, CancellationToken cancellationToken)
        {


            var list = await mediator.Send(request);


            return list;



        }

        /// <summary>
        /// 副产赋值
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>

        [HttpPost]
        public async Task<Resqults> Handle(ReturnWeighingBackCommond request, CancellationToken cancellationToken)
        {



            var list =await mediator.Send(request);


            return list;




        }
        /// <summary>
        /// 副产称重分组显示
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults <WhiteGroupDTO>> postByproGroup(ByproductsGroupCommand info)
        {
            try
            {
                var res= await mediator.Send(info);
                return res;
            }
            catch (Exception)
            {

                throw;
            }
        }







        /// <summary>
        /// 副产修改
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> ReturnWeighingUpdate(ReturnWeighingUpdateCommond request, CancellationToken cancellationToken)
        {

            var list = await mediator.Send(request);
            return list;

        }
        /// <summary>
        /// 副产称重删除
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> ReturnWeighingDel(ReturnWeighingDelCommond request, CancellationToken cancellationToken)
        {
            var list = await mediator.Send(request);


            return list;
        }
        /// <summary>
        /// 进场登记详情
        /// </summary>
        /// <param name="infp"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults<SlaughteredDetailsInfoDTO>> ApproceInfoList(SlaughteredDetailsInfoCommand infp)
        {
            try
            {
                var res = await mediator.Send(infp);
                return res;
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 待宰圈管理入卷、移圈
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> AddSlaughterCraete(SlaughterCraeteCommand info)
        {
            try
            {
                var res =await mediator.Send(info);
                return res;
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 批宰列表（新增页）
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults<SlaugChooseDTO>> SlaughterCraeteList(SlaugSelectChooseCommand info)
        {
            try
            {
                var res = await mediator.Send(info); 
                return res;
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 批宰计划添加
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> BulkSlaughterCreate(BulkSlaughterCreateCommand info)
        {
            try
            {
                var res = await mediator.Send(info);
                return res;
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 批宰计划列表
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> BulkSlaughterSearch(BulkSlaughterSearchCommand info)
        {
            return await mediator.Send(info);
        }
        
        /// <summary>
        /// 白条页屠宰列表
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults<BuclkWeight>> WhiteBulkList(BuclkWeightListCommand info)
        {
            try
            {
                var res = await mediator.Send(info);
                return res;
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 商品代号添加
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> createShop(ShopCreateCommand info)
        {
            try
            {
                var res= await mediator.Send(info);
                return res;
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 商品代号列表
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults<Shopping>> getShop(ShopListCommand info)
        {
            try
            {
                var res=await mediator.Send(info);
                return res;
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 副产称重页面列表
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults<WhiteListDTo>> getWhiteListDTo(WhiteCreateListCommand info)
        {
            try
            {
                var res= await mediator.Send(info);
                return res;
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 仓库加载
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults<Stash>> StashList(StashsListCommand info)
        {
            try
            {
                var res=await mediator.Send(info);
                return res;
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 日志管理添加
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> LoginCreate(LoginCreateCommond request, CancellationToken cancellationToken)
        {

            try
            {
                var list=await mediator.Send(request);
                return list;
            }
            catch (Exception)
            {

                throw;
            }

        }

        /// <summary>
        /// 日志管理显示
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> LoginHtml(LoginHtmlCommond request, CancellationToken cancellationToken)
        {
            try
            {
                var list = await mediator.Send(request);

                return list;

            }
            catch (Exception)
            {

                throw;
            }


        }
        /// <summary>
        /// 进场检验单
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> ApproachInspectionCreate(ApproachInspectionCreateCommond request, CancellationToken cancellationToken)
        {
            try
            {


                var list =await mediator.Send(request);

                return list;


            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 进场检验单列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// 
        [HttpPost]
        public async Task<Resqults> ApproachInspectionHtml(ApproachInspectionHtmlCommond request, CancellationToken cancellationToken)
        {
            try
            {
                var list = await mediator.Send(request);
                return list;
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 检验详情
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Resqults> InspectionDetailsCreate(InspectionDetailsCreateCommond request, CancellationToken cancellationToken)
        {
            var list = await mediator.Send(request);
            return list;
        }
    }
}
